{extend name="public:base" /}
{block name="head"}
<link href="__PUBLIC__/view_res/mobile/css/uc.css" type="text/css" rel="Stylesheet" />
<link href="__PUBLIC__/jquery-weui/dist/lib/weui.min.css" type="text/css" rel="Stylesheet" />
<link href="__PUBLIC__/jquery-weui/dist/css/jquery-weui.min.css" type="text/css" rel="Stylesheet" />
<script src="__PUBLIC__/jquery-weui/dist/js/jquery-weui.min.js"></script>
{/block} 
{block name="header"}
{include file="public/top-nav" /}
{/block}

{block name="content"}
<?php use think\Db; ?>
<div class="exp-item-info clearfix" style="margin-top:0;">
    <span class="order-status"><?php echo get_order_status_name($order['order']['order_status_id']); ?></span>
    <span class="order-id">订单号： {$order.order.order_num_alias} </span>
</div>
{if condition="$order['order']['address_id'] NEQ 0"}
<div class="exp-item-info" style="background:url(__RES__/mobile/images/icon/od-exp-bh.png) left top repeat-x #fff;padding:0;padding-top:15px;">
    <div style="padding:0 10px;">
        <div class="clearfix">
            <span class="od-name">{$order.order.shipping_name}</span>
            <span class="od-tel">{$order.order.shipping_tel}</span>
        </div>
        <div class="od-address">
        	<?php echo get_area_name($order['order']['city_id']).','.get_area_name($order['order']['country_id']).','.$order['order']['address']; ?>
		</div>
    </div>
    <div style="height:15px;background:url(__RES__/mobile/images/icon/od-exp-bh.png) left bottom repeat-x #fff;"></div>
</div>
{/if}
<div class="exp-item-info">
    <div class="exp-item-caption">物品信息</div>
    {volist name="order['order_product']" id="d"}
        <div class="clearfix items" onclick="location = '{:get_goods_type_info(array("type"=>$d["type"],"module"=>"mobile","goods_id"=>$d["goods_id"]),"url")}';">
            <img class="ucoi-pic" src="IMG_ROOT{$d.image|resize=100,100}">
            <div class="ucoi-con">
                <span class="title Elipsis">{$d.name}</span>                        
                <?php if($option_list=Db::query('select * from '.config('database.prefix').'order_option where order_goods_id='.$d['order_goods_id'].' and order_id='.$d['order_id'])){ ?>
				<?php foreach ($option_list as $option) { ?>		               
                &nbsp;<span class="spec"><?php echo $option['name']; ?>: <?php echo $option['value']; ?></span>
                <?php } ?>
                <?php } ?>
                            
                <span class="price">
                	<span class="prices">
                	{:get_goods_type_info(array('type'=>$order['order']['type'],'price'=>$d['price']),'price')}
                	</span> x <span class="dcount">{$d.quantity}</span>
                </span>
               
            </div>
        </div>
    {/volist}
</div>
<div class="exp-item-info">
    <div class="exp-item-caption">订单信息</div>
    
    <div class="exp-payinfo clearfix">
        <span class="left">订单编号：</span>
        <span class="right" style="color:#777;">{$order.order.order_num_alias}</span>
    </div>    

    {if condition="$order['order']['return_points'] NEQ 0"}	
        <div class="exp-payinfo clearfix">
            <span class="left">获得：</span>
            <span class="right" style="color:#777;">{$order.order.return_points}</span>
        </div>
    {/if}    


        <div class="exp-payinfo clearfix">
            <span class="left">订单总计：</span>
            <span class="right prices">{:get_goods_type_info(array('type'=>$order['order']['type'],'price'=>$order['order']['total']),'price')}</span>
        </div>
        
        {if condition="$order['order']['type'] NEQ config('points_goods') and $order['order']['type'] NEQ config('tuan_goods')"}
        <div class="exp-payinfo clearfix">
            <span class="left">运费：</span>
            <span class="right prices"><?php echo $order['order_total'][1]['text']; ?></span>
        </div>
        {/if}

</div>

{if condition="!empty($order['order']['transport_num'])"}
<div class="exp-item-info">
    <div class="exp-item-caption">物流信息</div>    

    <div class="exp-payinfo clearfix">
        <span class="left">公司名称：</span>
        <span class="right">{:osc_system()->get_express($order['order']['transport_c_name'])}</span>
    </div>
  <div class="exp-payinfo clearfix">
        <span class="left">运输单号：</span>
        <span class="right">{$order.order.transport_num}</span>
    </div>
    
    <a  order_id="{$order['order']['order_id']}" class="button green look">物流查询</a>
</div>
{/if}

<div class="exp-item-info">
    <div class="exp-item-caption">订单历史</div>    
  {volist name="order['order_history']" id="d"}
    <div class="exp-payinfo clearfix">
        <span class="left"><?php echo date("Y-m-d H:i:s",$d['date_added']).' '.get_order_status_name($d['order_status_id']); ?> </span>
        <span class="right">{if condition="!empty($d['comment'])"}留言 : {$d.comment}{/if} </span>
    </div>
  {/volist}
</div>

{/block}


{block name="script"}
<script>
$('.look').click(function(){
	
	var t=$(this);
	
	$.ajax({
		url: '{:url("Order/get_trace_info")}',
		data:{order_id:t.attr('order_id')},
		dataType: 'json',
		type: 'post',
		beforeSend: function() {
			$.showLoading();
		},
		complete: function() {},
		success: function(d) {
			
			$.hideLoading();
			
			if(d.error){
				$.toast(d.error, "forbidden");
			}else if(d.success){			
				location =d.url;		
			}
								
		}
	});
});  
</script>
{/block}